//
//  File.swift
//
//
//  Created by didi on 2022/9/14.
//

import Fluent

struct UserAccountModelMiddlware: AsyncModelMiddleware {
    func create(model: UserAccountModel, on db: Database, next: AnyAsyncModelResponder) async throws {
        model.email = model.email.lowercased()
        return try await next.create(model, on: db)
    }

    func update(model: UserAccountModel, on db: Database, next: AnyAsyncModelResponder) async throws {
        model.email = model.email.lowercased()
        return try await next.update(model, on: db)
    }
}
